//
//  VIZAddController.m
//  Young-Old
//
//  Created by 位立志 on 16/4/29.
//  Copyright © 2016年 位立志. All rights reserved.
//

#import "VIZAddController.h"

@interface VIZAddController ()

@end

@implementation VIZAddController

- (void)viewDidLoad {
    [super viewDidLoad];

    [self setController];
    
    self.tableView.tableHeaderView = [self setHeadView];
    
}


//设置控制器
- (void)setController{
    
    self.tableView.scrollEnabled = NO;
    
    //左边
    UIBarButtonItem *leftItem = [[UIBarButtonItem alloc]initWithTitle:@"取消" style:UIBarButtonItemStylePlain target:self action:@selector(cancleClick)];
    self.navigationItem.leftBarButtonItem = leftItem;
    
    //右边
    UIBarButtonItem *rightItem = [[UIBarButtonItem alloc]initWithTitle:@"完成" style:UIBarButtonItemStylePlain target:self action:@selector(doneClick)];
    self.navigationItem.rightBarButtonItem = rightItem;
    
    //标题
    [self setTitle:@"添加闹钟"];

    
}


#pragma mark - 点击取消
- (void)cancleClick{
    
    [self dismissViewControllerAnimated:YES completion:nil];
    
}


#pragma mark - 点击确定
- (void)doneClick{
    
    [self dismissViewControllerAnimated:YES completion:nil];
    
    
    
}





//设置头部视图
#warning dataPick的设置
- (UIView *)setHeadView{
    
    UIView *headView = [[UIView alloc]initWithFrame:self.view.frame];
    headView.height = self.view.frame.size.height/2;
    
    UIDatePicker *picker = [[UIDatePicker alloc]initWithFrame:headView.frame];
    
    picker.datePickerMode = UIDatePickerModeTime;
    picker.locale = [[NSLocale alloc]initWithLocaleIdentifier:@"zh-Hans"];
    picker.height = headView.frame.size.height*2/3;
    [headView addSubview:picker];
    
    return headView;
    
}




@end
